<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>speak</title>
  </head>
  <body></body>
  <script>
    function getQueryVariable(variable) {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
          return pair[1];
        }
      }
      return false;
    }

    var text = getQueryVariable("text");
    var msg = new SpeechSynthesisUtterance(decodeURI(text));
    console.log(msg);
    window.speechSynthesis.speak(msg);
  </script>
</html>